package tq.com.tqteacher.fragment;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import tq.com.tqteacher.R;

public class TQFragment extends Fragment {
    private int index = 0;

    static public TQFragment newInstance(int index){
        TQFragment fragment = new TQFragment();
        fragment.setIndex(index);
        return fragment;
    }
    public void setIndex(int i){
        index = i;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_main_layout, container, false);
        TextView textView = view.findViewById(R.id.index);
        textView.setText(String.valueOf(index));
        return view;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
    }
}
